package com.ysyx.ysyx_earlytrack.controller;

import com.ysyx.ysyx_earlytrack.dto.BaseDto;
import com.ysyx.ysyx_earlytrack.service.TrackService;
import org.redisson.api.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 *
 * @description: xxxx接口/类
 * @author:薛宇晖
 * @create:2023/4/12 14:06
 */
@RestController
public class TrackController {

    @Autowired
    private RedissonClient redissonClient;

    @Autowired
    private TrackService trackService;

    /*
     * @Description: (作用)查看订单中司机的位置
     * @params: orderId
     * @return: baseDto  101成功返回 102 存在异常，还没司机接单
     * @Author: 薛宇晖
     * @create:2023/4/12
     */

    @RequestMapping(value = "/track/passenger/gettrack/{orderId}",method = RequestMethod.GET)
    @ResponseBody
    public BaseDto getDriverGeo(@PathVariable String orderId){
        return trackService.getDriverGeo(orderId);
    }

    /*
     * @Description: (作用) 查看此订单历史轨迹   先看redis里面有没有  再查看数据库
     * @params: orderid 订单id
     * @return:
     * @Author: 薛宇晖
     * @create:2023/4/13
     */
    @RequestMapping("/track/histrorytrack/check/{orderId}")
    @ResponseBody
    public BaseDto queryHistoryTrack(@PathVariable String orderId){

        return trackService.queryHistoryTrack(orderId);
    }





}
